﻿using CTP.CRM.Core.Common.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CTP.CRM.Repository.Organization.Entitys
{
    /// <summary>
    /// 组织表
    /// </summary>
    [SugarTable("t_organization")]
    public class OrganizationEntity : IFullAuditedBasicEntitys
    {
        ///<summary>
        ///
        ///</summary>
        [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
        public int OrgId { get; set; }

        /// <summary>
        /// 组织Code
        /// </summary>
        [SugarColumn(ColumnName = "Code")]
        public string? Code { get; set; }

        ///<summary>
        /// 组织类型
        ///</summary>
        [SugarColumn(ColumnName = "Type")]
        public OrgTypeEnum Type { get; set; }

        ///<summary>
        /// 所属上级
        ///</summary>
        [SugarColumn(ColumnName = "ParentId")]
        public int ParentId { get; set; }

        /// <summary>
        /// 所属财务公司
        /// </summary>
        [SugarColumn(ColumnName = "ParentCompanyId")]
        public int? ParentCompanyId { get; set; }

        ///<summary>
        /// 组织简称
        ///</summary>
        [SugarColumn(ColumnName = "ShortName")]
        public string ShortName { get; set; }

        ///<summary>
        /// 英文组织简称
        ///</summary>
        [SugarColumn(ColumnName = "ShortNameEn")]
        public string ShortNameEn { get; set; }

        ///<summary>
        /// 组织中文名
        ///</summary>
        [SugarColumn(ColumnName = "CnName")]
        public string CnName { get; set; }

        ///<summary>
        /// 组织英文名
        ///</summary>
        [SugarColumn(ColumnName = "EnName")]
        public string EnName { get; set; }

        ///<summary>
        /// 业务代码
        ///</summary>
        [SugarColumn(ColumnName = "BusinessCode")]
        public string BusinessCode { get; set; }

        ///<summary>
        /// 部门标识（汇佰）1.销售部 2.市场部
        ///</summary>
        [SugarColumn(ColumnName = "DepartIdentity")]
        public int? DepartIdentity { get; set; }

        /// <summary>
        /// 组织业务类型
        /// </summary>
        public int? BizType { get; set; }

        ///<summary>
        /// Hrbp
        ///</summary>
        [SugarColumn(ColumnName = "Hrbp")]
        public int? Hrbp { get; set; }

        ///<summary>
        /// 区域财务
        ///</summary>
        [SugarColumn(ColumnName = "Finance")]
        public int? Finance { get; set; }

        ///<summary>
        /// 合同审核人
        ///</summary>
        [SugarColumn(ColumnName = "ContractReviewer")]
        public int? ContractReviewer { get; set; }

        ///<summary>
        /// 描述
        ///</summary>
        [SugarColumn(ColumnName = "Description")]
        public string Description { get; set; }

        ///<summary>
        /// 排序
        ///</summary>
        [SugarColumn(ColumnName = "Sort")]
        public int Sort { get; set; }

        ///<summary>
        /// 是否启用
        ///</summary>
        [SugarColumn(ColumnName = "IsEnable")]
        public bool IsEnable { get; set; }

        ///<summary>
        /// 业务属性
        ///</summary>
        [SugarColumn(ColumnName = "BizAttr")]
        public int? BizAttr { get; set; }

        ///<summary>
        /// 成本划型
        ///</summary>
        [SugarColumn(ColumnName = "CostType")]
        public int? CostType { get; set; }

        /// <summary>
        /// 劳务关联子系统
        /// </summary>
        [SugarColumn(ColumnName = "FinSystemId")]
        public int? FinSystemId { get; set; }


        /// <summary>
        /// 是否考核主体
        /// </summary>
        [SugarColumn(ColumnName = "IsEvaluationSubject")]
        public bool IsEvaluationSubject { get; set; }


        /// <summary>
        /// 是否法人主体
        /// </summary>
        [SugarColumn(ColumnName = "IsLegalSubject")]
        public bool IsLegalSubject { get; set; }


        /// <summary>
        /// 劳务成本分摊方式 
        /// </summary>
        [SugarColumn(ColumnName = "LaborCostAllocationMethod")]
        public LaborCostAllocationMethod? LaborCostAllocationMethod { get; set; }


        [SqlSugar.SugarColumn(IsIgnore = true)]
        public List<OrganizationEntity> Child { get; set; }

        /// <summary>
        /// 公司类型
        /// </summary>
        [SugarColumn(ColumnName = "CompanyType")]
        public int? CompanyType { get; set; }

#if !HbSystem
        // auth: xiw 2024-12-19
        // p31 https://gotofreight.feishu.cn/wiki/EKDyws7grigjsNk42K4c43Pwnl6 汇佰不需要这个字段，所以宏定义去掉了

        /// <summary>
        /// 在财务系统的所属部门，和ParentCompanyId关联
        /// </summary>
        [SugarColumn(ColumnName = "BelongDeptId")]
        public int? BelongDeptId { get; set; }

#endif

        /// <summary>
        /// 海外属性
        /// </summary>
        [SugarColumn(ColumnName = "OverseasAttributes")]
        public string OverseasAttributes { get; set; }
    }
}
